import service from '@/core/net/request'

export function getRoleList(page) {
  return service.get(`/api/admin/role/${page}`)
}

export function createRole(data) {
  return service.post('/api/admin/role', data)
}

export function updateRole(id, data) {
  return service.post('/api/admin/role/' + id, data)
}

export function deleteRole(id) {
  return service.post(`/api/admin/role/${id}/delete`)
}

export function updateRoleStatus(id, status) {
  return service.post(`/api/admin/role/${id}/update_status`, {
    status,
  })
}

export function setRoleRules(id, rule_ids) {
  return service.post(`/api/admin/role/set_rules`, {
    id,
    rule_ids,
  })
}
